cmake_minimum_required(VERSION 2.8)
cmake_policy(PUSH)
cmake_policy(SET CMP0028 NEW)
cmake_policy(SET CMP0048 NEW)

project(task_dispatcher_project
    VERSION 0.0.1
    LANGUAGES CXX
)

option(BUILD_TEST_APP "Build test app." ON)

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/output/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/output/lib)
set(CMAKE_PREFIX_PATH "${PROJECT_SOURCE_DIR}/output/cmake;${CMAKE_PREFIX_PATH}")

add_subdirectory(src)

if(BUILD_TEST_APP)
    add_executable(task_dispatcher_app test/main.cpp)
    target_include_directories(task_dispatcher_app
        PUBLIC
        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
        $<INSTALL_INTERFACE:include>
    )
    target_link_libraries(task_dispatcher_app task_dispatcher_lib)
endif(BUILD_TEST_APP)

add_custom_target(uninstall_task_dispatcher_project
    COMMAND cat install_manifest.txt | xargs rm
    WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
    COMMENT "Uninstall")

cmake_policy(POP)